<template>
  <el-tag
    :type="type"
    effect="dark"
    class="order-status-tag"
  >
    {{text}}
  </el-tag>
</template>

<script>
export default {
  name: "OrderStatusTag",
  props:{
    orderStatus:{
      require: true,
    },
    ignore:{
      default : 0,
    }
  },
  data(){
    return {
      text: '',
      type: '',
    }
  },
  created() {
    if(this.ignore === 1){
      this.type = 'ignore'
      this.text = '已忽略'
      return
    }
    switch (this.orderStatus){
      case 1:
        this.type = 'untreated'
        this.text = '未处理'
        break;
      case 2:
        this.type = 'waitReceived'
        this.text = '入库中'
        break;
      case 3:
        this.type = 'received'
        this.text = '已入库'
        break;
      case 4:
        this.type = 'cancel'
        this.text = '已取消'
        break;
      case 5:
        this.type = 'warning'
        this.text = '采购中'
        break;
    }
  },
}
</script>

<style scoped lang="scss">
.order-status-tag{
  font-weight: bold;
}
</style>
